\(\int \frac {\tan (a+i \log (x))}{x^2} \, dx\) [140]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 29 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=\frac {i}{x}+2 i e^{-i a} \arctan \left (e^{-i a} x\right ) \]

[Out]

I/x+2*I*arctan(x/exp(I*a))/exp(I*a)

Rubi [A] (verified)

Time = 0.04 (sec) , antiderivative size = 29, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {4591, 456, 464, 209} \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=2 i e^{-i a} \arctan \left (e^{-i a} x\right )+\frac {i}{x} \]

[In]

Int[Tan[a + I*Log[x]]/x^2,x]

[Out]

I/x + ((2*I)*ArcTan[x/E^(I*a)])/E^(I*a)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 464

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[c*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(a*e*(m + 1))), x] + Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(a*e^n*(m + 1)), In
t[(e*x)^(m + n)*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, p}, x] && NeQ[b*c - a*d, 0] && (IntegerQ[n] ||
GtQ[e, 0]) && ((GtQ[n, 0] && LtQ[m, -1]) || (LtQ[n, 0] && GtQ[m + n, -1])) &&  !ILtQ[p, -1]

Rule 4591

Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((I - I*E^(2*I*a*d)*
x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {i-\frac {i e^{2 i a}}{x^2}}{\left (1+\frac {e^{2 i a}}{x^2}\right ) x^2} \, dx \\ & = \int \frac {-i e^{2 i a}+i x^2}{x^2 \left (e^{2 i a}+x^2\right )} \, dx \\ & = \frac {i}{x}+2 i \int \frac {1}{e^{2 i a}+x^2} \, dx \\ & = \frac {i}{x}+2 i e^{-i a} \arctan \left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.52 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=\frac {i}{x}+2 i \arctan (x \cos (a)-i x \sin (a)) \cos (a)+2 \arctan (x \cos (a)-i x \sin (a)) \sin (a) \]

[In]

Integrate[Tan[a + I*Log[x]]/x^2,x]

[Out]

I/x + (2*I)*ArcTan[x*Cos[a] - I*x*Sin[a]]*Cos[a] + 2*ArcTan[x*Cos[a] - I*x*Sin[a]]*Sin[a]

Maple [A] (verified)

Time = 1.68 (sec) , antiderivative size = 24, normalized size of antiderivative = 0.83

method result size
risch \(\frac {i}{x}+2 i \arctan \left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{-i a}\) \(24\)

[In]

int(tan(a+I*ln(x))/x^2,x,method=_RETURNVERBOSE)

[Out]

I/x+2*I*arctan(x*exp(-I*a))*exp(-I*a)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (19) = 38\).

Time = 0.25 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.34 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=-\frac {{\left (x \log \left (x + i \, e^{\left (i \, a\right )}\right ) - x \log \left (x - i \, e^{\left (i \, a\right )}\right ) - i \, e^{\left (i \, a\right )}\right )} e^{\left (-i \, a\right )}}{x} \]

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="fricas")

[Out]

-(x*log(x + I*e^(I*a)) - x*log(x - I*e^(I*a)) - I*e^(I*a))*e^(-I*a)/x

Sympy [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.93 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=\left (\log {\left (x - i e^{i a} \right )} - \log {\left (x + i e^{i a} \right )}\right ) e^{- i a} + \frac {i}{x} \]

[In]

integrate(tan(a+I*ln(x))/x**2,x)

[Out]

(log(x - I*exp(I*a)) - log(x + I*exp(I*a)))*exp(-I*a) + I/x

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (19) = 38\).

Time = 0.30 (sec) , antiderivative size = 127, normalized size of antiderivative = 4.38 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=\frac {2 \, x {\left (-i \, \cos \left (a\right ) - \sin \left (a\right )\right )} \arctan \left (\frac {2 \, x \cos \left (a\right )}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}, \frac {x^{2} - \cos \left (a\right )^{2} - \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + x {\left (\cos \left (a\right ) - i \, \sin \left (a\right )\right )} \log \left (\frac {x^{2} + \cos \left (a\right )^{2} + 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + 2 i}{2 \, x} \]

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="maxima")

[Out]

1/2*(2*x*(-I*cos(a) - sin(a))*arctan2(2*x*cos(a)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2), (x^2 - cos(a)^2 - s
in(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + x*(cos(a) - I*sin(a))*log((x^2 + cos(a)^2 + 2*x*sin(a) +
sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + 2*I)/x

Giac [A] (verification not implemented)

none

Time = 0.36 (sec) , antiderivative size = 19, normalized size of antiderivative = 0.66 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=2 i \, \arctan \left (x e^{\left (-i \, a\right )}\right ) e^{\left (-i \, a\right )} + \frac {i}{x} \]

[In]

integrate(tan(a+I*log(x))/x^2,x, algorithm="giac")

[Out]

2*I*arctan(x*e^(-I*a))*e^(-I*a) + I/x

Mupad [B] (verification not implemented)

Time = 27.70 (sec) , antiderivative size = 27, normalized size of antiderivative = 0.93 \[ \int \frac {\tan (a+i \log (x))}{x^2} \, dx=\frac {\mathrm {atan}\left (\frac {x}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )\,2{}\mathrm {i}}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}+\frac {1{}\mathrm {i}}{x} \]

[In]

int(tan(a + log(x)*1i)/x^2,x)

[Out]

(atan(x/exp(a*2i)^(1/2))*2i)/exp(a*2i)^(1/2) + 1i/x